package org.liang.agile.arrays;

import org.liang.agile.collections.CollectionData;

public class Generated {

    public static <T> T[] array(T[] array, Generator<T> gen){
        return new CollectionData<T>(gen, array.length).toArray(array);
    }
    
    public static <T> T[] array(Class<T> type, Generator<T> gen, int size){
        @SuppressWarnings("unchecked")
        T[] array = (T[]) java.lang.reflect.Array.newInstance(type, size);
        return new CollectionData<T>(gen, size).toArray(array);
    }
}
